#include "ch32v00x.h"
#include "ch32v00x_gpio.h"
#include "ch32v00x_rcc.h"
#include "ch32v00x_usart.h"
#include "ch32v00x_tim.h"


#define KEY1PIN  GPIO_Pin_3//PC3
#define KEY1PORT GPIOC
#define KEY2PIN  GPIO_Pin_6//PC6
#define KEY2PORT GPIOC
#define LEDR_PIN GPIO_Pin_4//PD4
#define LEDR_PORT GPIOD
#define LEDB_PIN  GPIO_Pin_1//PC1
#define LEDB_PORT GPIOC
#define FAN_PIN   GPIO_Pin_5//PC5
#define FAN_PORT  GPIOC
#define COOLER_PIN   GPIO_Pin_2//PC2
#define COOLER_PORT  GPIOC
#define A2_PIN   GPIO_Pin_4//PC4
#define A2_PORT  GPIOC

#define VBUS_TARGET 12.f //设置的VBUS电压
#define TIM_FREQ 100
#define ARR (24000000/24/TIM_FREQ)
#define POWER_DIFFERENCE (ARR*0.15)
#define MIN_FAN_CCR (0.3*ARR)

void keyInit(void);
void ledInit(void);
void timInit(u16 arr , u16 psc);
void ADC_Function_Init(void);
float getVbusVolt(void);

